package com.unit2.pojo;

/**
 * @author 李琦 on 2021/8/3.
 * @version java version "16.0.1" 2021-04-20
 * 不用枚举,就是如下麻烦,so用枚举来实现
 */
public class Color {

    private  int id;
    private  String name;

    public static final Color c1=new Color(1,"红色");
    public static final Color c2=new Color(2,"绿色");
    public static final Color c3=new Color(3,"蓝色");


    private Color(int id, String name) {//构造方法设置为私有
        this.id = id;
        this.name = name;
    }
    //删除了set方法
    public int getId() {
        return id;
    }
    public String getName() {
        return name;
    }

}
